package coding.unit7;

/**
 * 1. 首先加载顶级父类中的static对象，然后再依次往下加载static对象
 * 2. 接着加载顶级父类中的构造方法~ ~
 *
 * @author Wang Renlei
 * @Date 2020/3/21
 */

class GenInsect {
    GenInsect() {
        System.out.println("根基类");
    }

    int a = printInt();

    int printInt() {
        System.out.println("hhh");
        return 0;
    }
}

class Insect extends GenInsect {
    private int i = 9;
    protected int j;

    Insect() {
        System.out.println("i = " + i + "，j" + j);
        j = 39;
    }

    private static int x1 = printInit("static Insect.x1 initialized");

    static int printInit(String s) {
        System.out.println(s);
        return 47;
    }
}

public class Beetle extends Insect {
    private int k = printInit("Beetle.k initialized");

    public Beetle() {
        System.out.println("k = " + k);
        System.out.println("j = " + j);
    }

    private static int x2 = printInit("static Beetle.x2 initizlized");

    public static void main(String[] args) {
        System.out.println("Beetle main()");
        Beetle beetle = new Beetle();
    }


}















